﻿using System.Collections.Generic;
using TTSIDAL;
using TTSModel;

namespace TTSBLL
{
    public class AssembleItem : BaseService<AssembleItemInfo>
    {
        private static readonly IAssembleItem dal = DALFactory.TTS_DataAccess.CreateAssembleItem();

        public override void SetCurrentRepository()
        {
            CurrentRepository = dal;
        }

        public IList<AssembleItemInfo> AssembleItem_GetbyID(int id)
        {
            return dal.AssembleItem_GetbyID(id);
        }
        public IList<AssembleItemInfo> AssembleItem_GetbySubSN(string SubSN)
        {
            return dal.AssembleItem_GetbySubSN(SubSN);
        }
        //-----------------------------以上只传递，以下有处理--------------------------------------------------
        /// <summary>
        /// SN是否作为子装配件装配过
        /// </summary>
        /// <param name="sn"></param>
        /// <returns></returns>
        public bool AssembleItem_SubSNAlreadyExist(string sn)
        {
            return !string.IsNullOrEmpty(dal.LoadEntity(sn).SN);
        }
    }
}
